<template>
 <div id="login">
 <h3>login</h3>
        <van-nav-bar
            left-text="返回"
            left-arrow
            @click-left="onClickLeft"
        />
        <!-- 登陆Form -->
        <van-form @submit="onSubmit">
        <van-field
            class="formUser"
            v-model="username"
            type="username"
            label="用户名"
            :rules="[{ required: true, message: '请填写用户名' }]"
        />
        <van-field
            v-model="password"
            type="password"
            label="密码"
            :rules="[{ required: true, message: '请填写密码' }]"
        />
        <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">
            登陆
            </van-button>
        </div>
        </van-form>
 </div>
</template>
<script>
import axios from 'axios'
 export default {
     data(){
         return{
            username: 'admin',
            password: 'ABCDEF',
         }
     },
     methods:{
        onClickLeft(){
            this.$router.go(-1)
        },
        onSubmit(info) {
            if(this.username=='admin'&&this.password=='ABCDEF'){
                console.log('登陆成功')
            }
        }
     }
 }
 </script>
<style lang="less">
#login{
    .formUser{
        margin-bottom: 20px;
    }
}
</style>